In [4]:
import escher
import escher.urls
import cobra
import cobra.test
import json
import os
from IPython.display import HTML
In [5]:
d = escher.urls.root_directory
print('Escher directory: %s' % d)
In [6]:
escher.list_available_maps()
Out[6]:
In [7]:
b = escher.Builder(map_name='e_coli_core.Core metabolism')
b.display_in_notebook()
Out[7]:
In [9]:
model = cobra.io.json.from_json(escher.plots.model_json_for_name('e_coli_core'))
solution = model.optimize()
print('Growth rate: %.2f' % solution.f)
In [10]:
b = escher.Builder(map_name='e_coli_core.Core metabolism',
reaction_data=solution.x_dict,
# color and size according to the absolute value
reaction_styles=['color', 'size', 'abs', 'text'],
# change the default colors
reaction_scale=[{'type': 'min', 'color': '#cccccc', 'size': 4},
{'type': 'mean', 'color': '#0000dd', 'size': 20},
{'type': 'max', 'color': '#ff0000', 'size': 40}],
# only show the primary metabolites
hide_secondary_metabolites=True)
b.display_in_notebook()
Out[10]:
In [11]:
model_modified = model.copy()
# for example, delete a reaction
model_modified.reactions.GAPD.delete()
In [12]:
# pass the model to a new builder
b = escher.Builder(map_name='e_coli_core.Core metabolism',
model=model_modified,
# in the map, highlight all reactions that are missing from the model
highlight_missing=True)
b.display_in_notebook()
Out[12]:
In [ ]:
# open the Builder in a new tab to edit this map with your modified model
b.display_in_browser()
In [ ]: